<?php 
global $site_info;

if(!empty($category)):
$cat_name = $this->_global->_unserialize($category->cat_name);
$cat_desc = $this->_global->_unserialize($category->cat_desc);
$site_info['site_title']= $cat_name[$this->session->userdata('lan')]['title'].' - '.$site_info['site_title'];

endif;
?>

<div class="content" style="border: none;">

<?php if(!empty($categories)):
foreach($categories as $cat):
$cat_name = $this->_global->_unserialize($cat->cat_name);
$cat_desc = $this->_global->_unserialize($cat->cat_desc);
$alias = $this->_global->_unserialize($cat->cat_alias);
$c_alias = $alias = $alias[$this->session->userdata('lan')]['alias'];
?>
<div class="content" style="float: none;margin-top: 5px;">
<h1 class="title"><?php echo anchor('news/'.$alias.'-'.$cat->cat_id,$cat_name[$this->session->userdata('lan')]['title'],' style ="color:#fff" title="'.$cat_name[$this->session->userdata('lan')]['title'].'"'); ?></h1>
<?php $posts = _get_posts2($cat->cat_id);
    if(!empty($posts)){
        if(count($posts)==1){
            $style = 'style="width:95%;float:none;"';
        }else
        $style='';
        foreach($posts as $post){
            $title = $this->_global->_unserialize($post->post_title);
            $title = $title[$this->session->userdata('lan')]['post_title'];
            $alias = $this->_global->_unserialize($post->seo_alias);
            $alias = $alias[$this->session->userdata('lan')]['alias'];
            $desc = $this->_global->_unserialize($post->post_desc);
            $desc = $desc[$this->session->userdata('lan')]['post_desc'];
            $p =  $this->_global->_unserialize($post->post_content);
            $p = $p[$this->session->userdata('lan')]['post_content'];
?>
<div class="posts" <?php echo $style ?>>
    <h2><?php echo anchor('news/c'.$post->cat_id.'/'.$alias.'-'.$post->post_id,$title,'title="'.$title.'"') ?></h2>
    <p><img style="margin-right: 5px;" alt="<?php echo $title ?>" title="<?php echo $title ?>" src="<?php echo _get_thumbnail($p) ?>" width=120 height=100 align="left"/><?php echo substr(strip_tags($desc),0,150) ?> ...</p>
    <p align="right"><?php echo anchor('news/c'.$post->cat_id.'/'.$alias.'-'.$post->post_id,'Xem tiếp','title="'.$title.'"') ?></p>
            
</div>
<?php
        }
    }else{
        echo '<h2 align=center>Chưa có bài viết</h2>';
    }
?>
<div class="clear"></div>
<p align="right"><?php echo anchor('news/'.$c_alias.'-'.$cat->cat_id,'<b><i>Xem các bài viết cũ</i></b>','title="'.$cat_name[$this->session->userdata('lan')]['title'].'"'); ?></p>

</div>
<?php endforeach;endif;?>
</div>


